package com.shiehub.sdk.opengw.enmu;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shie
 * @Description: 各个环境的配置枚举信息
 * @date 2016-10-12
 */
public class ShieEnv {

  private static List<ShieEnv> envList = new ArrayList<ShieEnv>();

  /**
   * 环境代码
   */
  private String envCode;
  /**
   * 请求URL
   */
  private String url;
  /**
   * 环境公钥
   */
  private String publicKey;
  /**
   * 环境描述
   */
  private String description;

  public ShieEnv(String envCode, String url, String publicKey, String description) {
    this.envCode = envCode;
    this.url = url;
    this.publicKey = publicKey;
    this.description = description;
    envList.add(this);
  }

  public static ShieEnv get(String envCode) {
    for(ShieEnv env: envList) {
      if (env.getEnvCode().equals(envCode)) {
        return env;
      }
    }
    return null;
  }

  /**
   * 获取环境代码
   */
  public String getEnvCode() {
    return envCode;
  }

  public void setEnvCode(String envCode) {
    this.envCode = envCode;
  }

  /**
   * 获取服务URL
   */
  public String getUrl() {
    return url;
  }

  public void setUrl(String url) {
    this.url = url;
  }

  /**
   * 获取公钥
   */
  public String getPublicKey() {
    return publicKey;
  }

  public void setPublicKey(String publicKey) {
    this.publicKey = publicKey;
  }

  /**
   * 描述信息
   */
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }
}
